import {INCREMENT} from './constant'
//定义初始化数据
const initState = {
    count:0,
    company:{
        name:'qf',
        lesson:'H5'
    }
}
//state=initState --->拷贝初始化数据
export default function reducer(state=initState,{type}){
    //返回值就是state
    //返回新的状态
    const newState = {...state}  //...浅拷贝数据层级简单就是浅拷贝，数据层级深就用深拷贝
    //深拷贝
    // const newState = JSON.parse(JSON.stringify(state))  //深拷贝

    switch(type){
        case INCREMENT:
            newState.count++
            break ;
    }
    return newState
}